<template>
  <div class="transferMaterial-content">
          <div class="transferMaterialBox">
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">{{titleFilter(type)}}</div>
                </div>
                <div class="tableBox">
                          <div class="tr soildTop per100 display-fx-center">
                              <div class="td">
                                    <span>用工单位</span>
                              </div>
                              <div class="full">{{infoData.enterpriseName}}</div>
                          </div>
                 </div>
                <div class="tableBox">
                            <div class="tr  display-fx-center">
                              <div class="td">
                                    <span>姓名</span>
                              </div>
                              <div class="full" style="border-right:none">{{infoData.personnelName}}</div>
                          </div>
              
                          <div class="tr display-fx-center">
                                <div class="td">
                                    <span>身份证号码</span>
                                </div>
                                <div class="full">{{infoData.identityNumber}}</div>
                          </div>
                </div>

                <div class="tableBox">
                            <div class="tr  display-fx-center">
                              <div class="td">
                                    <span>体检日期</span>
                              </div>
                              <div class="full" style="border-right:none">{{infoData.examTime}}</div>
                          </div>
              
                          <div class="tr display-fx-center">
                                <div class="td">
                                    <span>报告出具日期</span>
                                </div>
                                <div class="full">{{infoData.reportIssueTime}}</div>
                          </div>
                </div>

                <div class="tableBox">
                            <div class="tr  display-fx-center">
                              <div class="td">
                                    <span v-if="type != 5">体检结果</span> 
                                    <span v-if="type == 5">诊断委托机构</span>
                              </div>
                              <div class="full" style="border-right:none">{{type == 5?infoData.diagnoseOrg:infoData.examResult}}</div>
                          </div>
              
                          <div class="tr display-fx-center">
                                <div class="td">
                                    <span v-if="type == 3">原工种</span>
                                    <span v-if="type==4 || type==5">工种</span>
                                </div>
                                <div class="full">{{type == 3?infoData.originJobCategory:infoData.jobCategory}}</div>
                          </div>
                </div>
                <div class="tableBox" v-if="type == 3">
                          <div class="tr per100 display-fx-center">
                              <div class="td">
                                    <span>调岗工种</span>
                              </div>
                              <div class="full">{{infoData.transferJobCategory}}</div>
                          </div>
                 </div>

                 <div class="tableBox">
                          <div class="tr trBox">
                              <div class="td">
                                    <span>{{type==3?'调岗材料':type==4?'疑似职业病报告文件':'诊断委托材料'}}</span>
                              </div>
                              <div class="full">
                                    <div class="imageBox" v-for="(item,index) in infoData.docList" :key="index + 't'">
                                         <!-- <div > -->
                                              <!-- <el-image class="image" src="https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg" fit="cover"></el-image> -->
                                              <div>{{item.documentFileName}}</div>
                                              <div class="txt" @click="handleDetail(item)">下载查看</div>
                                         <!-- </div> -->
                                    </div>
                              </div>
                          </div>
                 </div>

                

               <div class="footer-btn">
                      <el-button class="btn" @click="goBackBtn">返回</el-button>
               </div>
          </div>

  </div>
</template>

<script>
import { getTransferMaterial,getIndustrialDisease,getDiagnosisContracts} from "@/api/zhangping/occupational";
  export default {
    data() {
      return {
         infoData:{},
         queryParams:{
              creditCode:'',
              personnelId:''
         },  
         type:"3"
      };
    },
    created() {
        this.queryParams.creditCode = this.$route.query.creditCode
        this.queryParams.personnelId = this.$route.query.personnelId
        this.type = this.$route.query.type
        this.getInvoke(this.type)
    },
    methods: {
         getInvoke(index){
             switch (index) {
                case "3": 
                      this.getTransferMaterialFn()  
                break;
                case "4": 
                      this.getIndustrialDiseaseFn()    
                break;
                case "5": 
                      this.getDiagnosisContractsFn()    
                break;
                default: 
                break;
             }
         },
         getTransferMaterialFn(){
            getTransferMaterial(this.queryParams).then(res=>{
                  if(res.code == 200){
                        this.infoData = res.data
                  }else{
                        this.$message.error(res.msg);  
                  }    
            })
        },
        getIndustrialDiseaseFn(){
                getIndustrialDisease(this.queryParams).then(res=>{
                  if(res.code == 200){
                        this.infoData = res.data
                  }else{
                        this.$message.error(res.msg);  
                  }    
            }) 
        },
         getDiagnosisContractsFn(){
                getDiagnosisContracts(this.queryParams).then(res=>{
                  if(res.code == 200){
                        this.infoData = res.data
                  }else{
                        this.$message.error(res.msg);  
                  }    
            }) 
        },
        handleDetail(item){
             window.open(item.documentFileUrl)
        },
        titleFilter(type){
             let name = ''
            if(type == 3){  
                 name = '查看调岗材料'
            }else if(type == 4){
                 name = '疑似职业病报告文件'
            }else{
                 name = '查看诊断委托材料'
            }
            return name 
        },
        goBackBtn(){
          this.$router.back()
        },
    }
  };
</script>
<style lang="scss" scoped>
         .display-fx-center{
             display: flex;
             align-items: center;
         }
         .flex-wrap{
            flex-wrap: wrap;
         }
         .per100{
             width: 100%!important;
         }
         .per50{
            width: 50%!important;
         }
         .soildTop{
             border-top:solid 1px  #D3D8E2;
         }
         .transferMaterial-content{
              overflow-y: auto;
              position: relative;
              background-color: #fff;
              padding: 40px 20px;
              border-radius: 10px;
              height: calc( 100vh - 66px - 128px);
              // display: flex;
              // flex-direction: column;
             .transferMaterialBox{
                    max-width: 930px;
                    margin: 0 auto;
                    padding-bottom:40px;

              }
            .header{
                 font-size: 22px;
                 font-weight: bold; 
                 color: #484848;
                 text-align: center;
            }
            .txt1{
                 font-size: 12px;
                 color: #797C84;
                 @extend .display-fx-center;
                 justify-content: center;
                 margin: 20px 0;
                 .line{
                      border-left: solid 1px #797C84; 
                      height: 12px;
                      margin: 0 6px 0 6px;
                      position: relative;
                      top: 1px;
                   }
                }
            .tableBox{
                  font-size: 14px;
                  @extend .display-fx-center;
                  .tr{
                      width: 50%;
                      display: flex;
                      min-height: 49px;
                      .td{
                       width: 150px;
                       line-height: 49px;
                       border: solid 1px #D3D8E2;
                       background: #F4F8FF;
                       padding: 0 8px;
                       border-top:none;
                       border-right:none;
                       color: #797C84;
                       flex-shrink: 0;         
                   }
                   .full{
                         width: 100%;
                         height: 100%;
                         line-height: 50px;
                         min-height: 50px;
                         border: solid 1px #D3D8E2;
                         border-top:none;  
                         padding: 0 10px; 
                         .imageBox{
                            line-height: 35px;
                            margin-right:10px;
                            cursor: pointer;
                            @extend .display-fx-center;
                         }
                         .image{
                              width: 145px;
                              height: 145px;
                         }  
                         .txt{
                            color: #5D85FF;
                            text-align: center;
                            // line-height: 14px!important;
                            // margin-top:-10px;
                            margin-left:10px;
                         }          
                      }
                    .upload{
                      text-align:center;
                      color:#5D85FF;
                      cursor: pointer;
                    }
                  } 
                  .trBox{
                     @extend .per100;
                     @extend .display-fx-center; 
                     border: solid 1px #D3D8E2;
                     border-top:none;
                     background: #F4F8FF;
                     .td{
                          border: none;
                          width: 149px;
                      }
                     .full{
                         border-right:none;
                         border-bottom: none;
                         background: #FFFFFF;  
                         min-height: 200px; 
                         padding: 10px; 
                     } 
                  }
            }
           .headerBox{
                font-size: 16px;
                color: #484848;
                font-weight: bold;
                // margin-top:40px;
                margin-bottom:15px;
                @extend .display-fx-center;
                .line{
                  width: 4px;
                  height: 12px;
                  background: #5D85FF;
                  border-radius: 6px 6px 6px 6px;
                  margin-right:6px;
                }
             }
             .video{
               width: 100%;
               height: 492px;
               background: #2D2D2D;
             }
             .examineBox{     
                  .title{
                      font-weight: bold;
                      font-size: 14px;
                      color: #484848;
                      line-height: 38px;
                      height: 38px;
                      border: 1px solid #D3D8E2;
                      background: #F4F8FF;
                      padding: 0 10px;
                   }
                   .tr{
                      display: flex;
                      line-height: 38px;
                      color: #797C84;
                      font-size: 14px;
                      border: 1px solid #D3D8E2;
                      border-top:none;
                      .td{
                          width: 820px;
                          border-right:1px solid #D3D8E2;
                          padding: 0 10px;
                      }
                   }
                   .active{
                         border-top:none!important;
                   }
                  
             }
          }
          .footer-btn{
                 width: 100%;
                 background: #FFFFFF;
                 height: 78px;
                 position: fixed;
                 bottom: 0;
                 right: 0;
                .btn{
                   position: fixed;
                   bottom: 20px;
                   right: 20px;    
                }
                 
          }
        ::v-deep{
            .el-table__header-wrapper th{
                 background: #F4F8FF!important;    
           }
          //  鼠标移入表格行不变色
          .el-table .el-table__row:hover td {
            background-color: transparent !important;
          }
        }
</style>
